﻿package com.cl.edu.entity;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Transient;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 高校
 * Highschool entity. 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "highschool")
public class Highschool implements java.io.Serializable {

	// Fields

	private Long id;		//编号 
	private String name;	//高校名称
	private Integer type;	//类型
	private String sname;   //短名字
	private String encodeName;
	// Constructors

	/** default constructor */
	public Highschool() {
	}

	/** full constructor */
	public Highschool(String name, Integer type) {
		this.name = name;
		this.type = type;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "type")
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public void setSname(String sname) {
		this.sname = sname;
	}
	@Column(name = "sname", length = 50)
	public String getSname() {
		return sname;
	}

	public void setEncodeName(String encodeName) {
		this.encodeName = encodeName;
	}
	@Transient
	public String getEncodeName() {
		try {
			return URLEncoder.encode(name, "utf-8");
		} catch (UnsupportedEncodingException e) {
			return "";
		}
	}

}